<?php
$sp = 20;
for ($i = 1; $i <= 19; $i += 2) {
    --$sp;
    //echo str_repeat(" ", $sp) . str_repeat("*", $i), "\n";
    echo str_pad(str_repeat("*", $i), 30, " ", 2) . "\n";
}
for ($i = 17; $i >= 1; $i -= 2) {
    ++$sp;
    //echo str_repeat(" ", $sp) . str_repeat("*", $i), "\n";
    echo str_pad(str_repeat("*", $i), 30, " ", 2) . "\n";
}
